const app = getApp()
Page({
  data: {
    awardList: []
  },
  onLoad() {
    app.awardList = app.mapList(app.awardList)
    this.setData({
      awardList: app.awardList
    })
  },
  /**
   * onQueryDetail 获取获奖用户详情
   * @param {*} e 
   */
  onQueryDetail(e) {
    const index = e && e.target && e.target.dataset && e.target.dataset.index;
    my.navigateTo({
      url: '/pages/award-detail/award-detail?index=' + index
    });
  },
  /**
   * onLottery 抽奖
   */
  onLottery() {
    app.onLottery().then((res)=>{
      app.awardList = res;
      my.hideLoading();
      app.awardList = app.mapList(app.awardList)
      this.setData({
        awardList: app.awardList
      })
    })
  }
});
